package com.aboo.infrastructure.aop.user.action;

import com.aboo.infrastructure.aop.user.domain.po.UserPo;
import com.aboo.infrastructure.aop.user.domain.vo.UserVo;
import com.aboo.infrastructure.aop.user.service.RoleService;
import com.aboo.infrastructure.aop.user.service.UserService;
import com.aboo.infrastructure.base.domain.dto.Result;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName UserAction
 * @Description
 * @Author louan
 * @Date 2021/3/22
 */
@Slf4j
@RestController
@RequestMapping(value = "/user")
public class UserAction {

    @Resource
    private UserService userService;
    @Resource
    private RoleService roleService;

    @PostMapping(value = "/test01")
    public Result<Void> test01(UserVo userVo) {
        log.info("UserAction do test01");

        userService.noReturnMethod(userVo, 3L);
        UserPo userPo = userService.returnMethod(userVo, 4L);
        log.info("return:{}", JSONObject.toJSONString(userPo));

        roleService.noReturnMethod(15L);
        roleService.returnMethod(16L);

        return Result.success();
    }

}
